<template>
	<!-- 经典案例详情 -->
	<view class="jdDetail" v-if="pageObj">
		<h1 class="h1">{{pageObj.serviceName}}</h1>
		<view v-if="pageObj.glassDescribe" class="p1 mb20" v-html="pageObj.glassDescribe"></view>
		<view v-if="pageObj.imgUrl" class="flex flex-y-center">文件：<button class="btn" @click="goPdf">查看文件</button>
		</view>
	</view>
</template>

<script setup>
	import config from '@/common/config.js'
	import {
		ref,
		getCurrentInstance,
		nextTick
	} from "vue";
	const pageObj = ref(null)
	import {
		serviceDetail,
	} from "@/api/index.js";
	onLoad((opt) => {
		serviceDetail(({
			id: opt.id,
		})).then((res) => {
			pageObj.value = res.data
		})
	})
	const goPdf = () => {
		const params = new URLSearchParams();
		params.append('url', config.baseUrl + pageObj.value.imgUrl);
		uni.navigateTo({
			url: `/pages/webView/webView?${params.toString()}`
		})
	}
</script>

<style lang="scss" scoped>
	.jdDetail {
		padding: 0 30rpx 50rpx 30rpx;

		.h1 {
			font-size: 30rpx;
			font-weight: 600;
			color: #000;
			line-height: 80rpx;
		}

		image {
			width: 100%;
		}

		.p1 {
			text-indent: 2em;
			font-size: 30rpx;
			color: #333;
			line-height: 40rpx;
		}

		.btn {
			background-color: #E60619;
			color: #fff;
			margin: 0;
			height: 66rpx;
			line-height: 66rpx;
			font-size: 26rpx;
		}
	}
</style>